<?php

namespace Dcat\Admin\Caijiwebinfo;

use Dcat\Admin\Extend\Setting as Form;

class Setting extends Form
{
    public function form()
    {
        $this->text('caiji_apihost','采集器api域名')->default('https://modstart.saishiyun.net')->required();
        $this->text('caiji_token','采集器token')->help('联系WX:Q3664839 获取')->required();
        $this->radio('is_save_log','开启采集日志')->options(['1'=> '开启','0'=>'关闭']);
        $this->radio('is_resources_save','资源是否储存')
            ->options(['1'=> '不保存','2'=>'保存'])->when('2',function (){
                $this->text('save_path','资源储存路径')->default('/caijiwebinfo')->required();
                $this->radio('resources_save','资源储存')
                    ->options(['local'=> '本地','cos'=> '腾讯云'])
                    ->when('cos',function (){
                        $this->radio('clear_local_media','上传成功后清除本地资源')->options([0=>'不清除',1=>'清除']);
                        $this->text('region','区域')->help('<a href="https://cloud.tencent.com/document/product/436/12266" target="_blank"> 腾讯云cos 文档</a>');
                        $this->text('appId','AppId')->help('<a href="https://console.cloud.tencent.com/developer" target="_blank"> 腾讯云用户中心获取</a>');
                        $this->text('secretId','secretId')->help('<a href="https://console.cloud.tencent.com/cam/capi" target="_blank"> 获取 secretId</a>');
                        $this->text('secretKey','secretKey');
                        $this->text('Bucket','存储桶名称');
                        $this->text('domain','自定义域名')->help('请补全:https:// . 如何配置自定义域名<a href="https://cloud.tencent.com/document/product/436/11142" target="_blank">查看</a>');
                    })
                    ->required();
            })->required();


    }
}
